package com.yuyu.shop.remote.fallback;

import com.yuyu.commons.interceptor.response.ResponseJson;
import com.yuyu.shop.remote.IOrderServiceMicroService;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author
 * @version 1.0
 * @description: TODO
 * @date 2022/9/28 17:07
 */
@Component
@Slf4j
public class OrderServiceFallBackFactory implements FallbackFactory<IOrderServiceMicroService> {
    @Override
    public IOrderServiceMicroService create(Throwable throwable) {
        log.error("remote api is error,the reason is{}",throwable.toString());
        return orderId -> ResponseJson.error("0","系统繁忙,请稍候再试!");
    }
}
